if(ctype_alnum($string)){ echo "Yes, It's an alphanumeric string/text"; } else{ echo "No, It's not an alphanumeric string/text"; }